echo "=== BUILD TAGS ==="
rname="wupper-drivers-02-00-00"
rtag="0.0.0"

release_name_to_tag () {
  local num=$(echo $rname | sed -e "s/^wupper-drivers-//")
  local major=$(( $(echo $num | cut -d '-' -f 1 )))
  local minor=$(( $(echo $num | cut -d '-' -f 2 )))
  local bugfix=$(( $(echo $num | cut -d '-' -f 3 )))
  rtag="$major.$minor.$bugfix"
  echo "Release tag:        $rtag"
}

if [ -z $CI_COMMIT_TAG ]; then
    echo "Release name:       wupper-drivers-00-00-00" 
else
    echo "Release name:       $CI_COMMIT_TAG"
    rname=$CI_COMMIT_TAG
fi

release_name_to_tag
export RELEASE_NAME=$rname
export RELEASE_TAG=$rtag

export GIT_BUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
export GIT_BUILD_HASH=$(git describe --always --dirty)
echo "wupper-tdaq-drivers: $GIT_BUILD_HASH"

echo "=================="
